/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.gov.ana.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author lucas.nunes
 */
@Entity
@Table(name = "QLTTB_PERIODICIDADE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Periodicidade.findAll", query = "SELECT p FROM Periodicidade p"),
    @NamedQuery(name = "Periodicidade.findByPrdId", query = "SELECT p FROM Periodicidade p WHERE p.prdId = :prdId"),
    @NamedQuery(name = "Periodicidade.findByPrdNm", query = "SELECT p FROM Periodicidade p WHERE p.prdNm = :prdNm"),
    @NamedQuery(name = "Periodicidade.findByPrdDs", query = "SELECT p FROM Periodicidade p WHERE p.prdDs = :prdDs")})
public class Periodicidade implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "PRD_ID")
    private BigDecimal prdId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 104)
    @Column(name = "PRD_NM")
    private String prdNm;
    @Size(max = 4000)
    @Column(name = "PRD_DS")
    private String prdDs;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cvhPrdId")
    private List<CaracterizacaoVhm> caracterizacaoVhmList;

    public Periodicidade() {
    }

    public Periodicidade(BigDecimal prdId) {
        this.prdId = prdId;
    }

    public Periodicidade(BigDecimal prdId, String prdNm) {
        this.prdId = prdId;
        this.prdNm = prdNm;
    }

    public BigDecimal getPrdId() {
        return prdId;
    }

    public void setPrdId(BigDecimal prdId) {
        this.prdId = prdId;
    }

    public String getPrdNm() {
        return prdNm;
    }

    public void setPrdNm(String prdNm) {
        this.prdNm = prdNm;
    }

    public String getPrdDs() {
        return prdDs;
    }

    public void setPrdDs(String prdDs) {
        this.prdDs = prdDs;
    }

    @XmlTransient
    public List<CaracterizacaoVhm> getCaracterizacaoVhmList() {
        return caracterizacaoVhmList;
    }

    public void setCaracterizacaoVhmList(List<CaracterizacaoVhm> caracterizacaoVhmList) {
        this.caracterizacaoVhmList = caracterizacaoVhmList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (prdId != null ? prdId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Periodicidade)) {
            return false;
        }
        Periodicidade other = (Periodicidade) object;
        if ((this.prdId == null && other.prdId != null) || (this.prdId != null && !this.prdId.equals(other.prdId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.gov.ana.service.Periodicidade[ prdId=" + prdId + " ]";
    }
    
}
